//
//  MeetingController.swift
//  YiYaoHui
//
//  Created by HM on 16/1/16.
//  Copyright © 2016年 TMPercy. All rights reserved.
//

import UIKit
import MBProgressHUD


class MeetingDetailController: UIViewController,UIWebViewDelegate {
    
    var id:Int! //1为从会议跳转过来的；2为从视频跳转过来的; //3为企业详情页面跳过来，显示企业主页
    
    var meetingTitle : String!
    var meetingURL : String!
    
    var vedioTitle: String!
    var vedioURL : String!

    var enterpriseTitle : String!
    var enterpriseHomePageURL: String!
    
    @IBOutlet weak var meetingWebView: UIWebView!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        self.automaticallyAdjustsScrollViewInsets = false//去除view上方空白
        MBProgressHUD.showHUDAddedTo(self.view, animated: true).labelText = "正在加载"
        switch id {
        case 1:
            self.title = meetingTitle
            getVideo(meetingURL)
            break
        case 2:
            self.title = vedioTitle
            getVideo(vedioURL)
            break
        case 3:
            self.title = enterpriseTitle
            getVideo(enterpriseHomePageURL)
            print(enterpriseHomePageURL)
            break
        default:
            break
        }
    }
   
    func getVideo(URL: String) {
        if let url = NSURL(string: URL) {
            let request = NSURLRequest(URL: url)
            meetingWebView.loadRequest(request)
            MBProgressHUD.hideHUDForView(self.view, animated: true)
        }
    }
    
    override func viewWillAppear(animated: Bool) {
        tabBarController?.tabBar.hidden = true
        navigationController?.navigationBarHidden = false
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

}
